/*
 * Copyright (c) 2023, 2024,yzc.cn All rights reserved.
 *
 */
package com.by.mq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>Project: erp-cloud-api - FinPlanMQConfig</p>
 * <p>Powered by yzc On 2024-01-16 10:57:26</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */
@Configuration
public class FinPlanMQConfig {
    /**
     * 定义回款计划消息队列
     *
     * @return
     */
    @Bean
    public Queue finPlanQueue() {
        return new Queue("finPlanQueue");
    }

    /**
     * 定义回款计划交换器
     *
     * @return
     */
    @Bean
    public DirectExchange finPlanExchange() {
        return new DirectExchange("finPlanExchange");
    }

    /**
     * 绑定队列和交换器
     *
     * @return
     */
    @Bean
    public Binding bindingFinPlan(Queue finPlanQueue, DirectExchange finPlanExchange) {
        return BindingBuilder.bind(finPlanQueue).to(finPlanExchange).with("finPlan");
    }

}
